Skip to content

Fixing broken (undefined behavior) ics.find_devices device_type filter#232

Open
pierreluctg wants to merge 1 commit into
intrepidcs:masterfrom
pierreluctg:patch-3
Open

Fixing broken (undefined behavior) ics.find_devices device_type filter#232
pierreluctg wants to merge 1 commit into
intrepidcs:masterfrom
pierreluctg:patch-3

Conversation

@pierreluctg

@pierreluctg pierreluctg commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Call to ics.find_devices wit a device_type filter value is broken (undefined behavior) due to wrong array reset argument

The fix changes new unsigned int(device_types_list_size)new unsigned int[device_types_list_size], so the allocation matches the unique_ptr<unsigned int[]> type and all subsequent device_types_list[i] accesses are valid.

Reference: https://en.cppreference.com/cpp/memory/unique_ptr/reset

Fixes #231

…defined behavior) due to wrong array reset argument

The fix changes `new unsigned int(device_types_list_size)` → `new unsigned int[device_types_list_size]`, so the allocation matches the `unique_ptr<unsigned int[]>` type and all subsequent `device_types_list[i]` accesses are valid.

Fixes intrepidcs#231
@pierreluctg

Copy link
Copy Markdown
Contributor Author

FYI @drebbe-intrepid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Call to ics.find_devices wit a device_type filter value is broken (undefined behavior) due to wrong array reset argument

1 participant